package com.spx.util;

import java.util.Properties;

/**
 * create by undeRdoG on  2022-04-30  11:12
 * 凡心所向，素履以往，生如逆旅，一苇以航。
 */
public class KafkaUtil {

    final public static Properties KAFKA_CONSUMER_PROPERTIES = new Properties();

    final public static Properties KAFKA_PRODUCER_PROPERTIES = new Properties();


    public static Properties getKafkaCunsumerProperties(String bootStrapServers, String groupId){
        KAFKA_CONSUMER_PROPERTIES.put("bootstrap.servers", bootStrapServers);
        KAFKA_CONSUMER_PROPERTIES.put("group.id", groupId);
        KAFKA_CONSUMER_PROPERTIES.setProperty("group.id", "consumer-group");
        KAFKA_CONSUMER_PROPERTIES.setProperty("key.deserializer",
                "org.apache.kafka.common.serialization.StringDeserializer");
        KAFKA_CONSUMER_PROPERTIES.setProperty("value.deserializer",
                "org.apache.kafka.common.serialization.StringDeserializer");
        KAFKA_CONSUMER_PROPERTIES.setProperty("auto.offset.reset", "latest");
        return KAFKA_CONSUMER_PROPERTIES;
    }


}
